<?php
include('conexion.php');
$email = mysqli_real_escape_string($cnx, $_POST['email']);
$clave = mysqli_real_escape_string($cnx, $_POST['clave']);

$consulta = "SELECT ID, NOMBRE, NIVEL FROM usuarios WHERE MAIL='$email' AND CLAVE=MD5('$clave') LIMIT 1";
$filas = mysqli_query($cnx, $consulta);
$datos = mysqli_fetch_assoc($filas);
if( $datos === null ){
	header("Location: ../../login.php?error");
	exit( );
}else{ //aca tengo datos
	$_SESSION['persona'] = $datos['NOMBRE'];
	$_SESSION['nivel'] = $datos['NIVEL'];
	header("Location: ../../index.php");
}

?>







